module.exports = {
  up: function(migration, DataTypes, done) {
    // add altering commands here, calling 'done' when finished

    migration.createTable('users',
      {
        id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
        email:       { type:  DataTypes.STRING },
        username:    { type:  DataTypes.STRING },
        password:    { type: DataTypes.STRING  },
        createdAt:   { type: DataTypes.DATE    },
        updatedAt:   { type: DataTypes.DATE    },
      },
      {
        engine: 'InnoDB', // default: 'InnoDB'
      }
    )

    // migration.addIndex('users', ['email'], {
    //   indexName: 'user_email_index',
    //    indicesType: 'UNIQUE'
    // })

    done()
  },
  down: function(migration, DataTypes, done) {
    // add reverting commands here, calling 'done' when finished
    migration.dropTable('users')
    done()
  }
}
